from rest_framework import serializers
from users.models import *


class Recruit_xxModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = Recruit
        fields = '__all__'


class RecruitEnterpriseModelSerializer(serializers.ModelSerializer):
    recruits = Recruit_xxModelSerializer(read_only=True, many=True)

    class Meta:
        model = Enterprise
        # fields = ['id', 'name', 'labels', 'logo', 'recruits', 'summary']
        fields = '__all__'


class RecruitModelSerializer(serializers.ModelSerializer):
    enterprise = RecruitEnterpriseModelSerializer(Enterprise.objects.all())

    class Meta:
        model = Recruit
        fields = '__all__'


class EnterpriseModelSerializer(serializers.ModelSerializer):
    recruits = RecruitModelSerializer(many=True)

    class Meta:
        model = Enterprise
        fields = '__all__'

class CityModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = City
        fields = '__all__'
